Image forming apparatus, control method therefor, and storage medium

ABSTRACT

There is provided a technique of appropriately shifting an image forming apparatus to a power saving state in consideration of the use status of an external device such as a connected USB device. When a condition for shifting to a sleep state is satisfied, the CPU of the image forming apparatus determines whether or not a setting of a sleep shift at the time of use of the USB device is “permit”. If it is determined that the setting of the sleep shift at the time of use of the USB device is “do not permit”, the CPU determines whether or not the connected USB device is in use. If it is determined that the USB device is not in use, the CPU shifts the image forming apparatus to the sleep state.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to an image forming apparatus, a control method therefor, and a storage medium.

Description of the Related Art

As a technique of reducing the power consumption of an information processing apparatus such as an image forming apparatus, there is known a technique of shifting the apparatus to a low power consumption state (power saving state) such as a sleep state when the apparatus has not been used for a predetermined time. When, for example, the user performs a predetermined operation, the information processing apparatus in the sleep state returns from the sleep state to enter a usable state. Such information processing apparatus is generally configured so that the user can designate a condition for shifting to the sleep state to some extent.

In recent years, because of user's rising awareness of energy saving (power saving), stipulation of various energy saving standards, and the like, there has been an increase demand to shift the information processing apparatus to the power saving state more often. However, if the information processing apparatus is often shifted to the power saving state, a user operation for shifting the apparatus from the power saving state to the usable state may be often required, thereby impairing the user convenience. Especially for an apparatus shared by a plurality of users, such as an image forming apparatus, since users who require power saving and users who require convenience may exist together, it is necessary to provide a condition for shifting to the power saving state, which is suitable for a larger number of users.

With respect to the information processing apparatus, when an external device such as a USB (Universal Serial Bus) device is connected, the type of the external device can be taken into consideration as a condition for shifting to the sleep state. An information processing apparatus disclosed in Japanese Patent Laid-Open No. 2009-302831 acquires a class set in a connected USB device, and automatically controls, based on the acquired class, whether or not to shift an image forming apparatus to the power saving state.

Recent image forming apparatuses are known to be compatible with USB over Network (to be referred to as “USBNW” hereinafter, as needed) technology of performing communication between an external information processing apparatus communicable via a network and a USB device connected to an image forming apparatus. Using the USBNW technology makes it possible to control the USB device via the image forming apparatus by a control application installed in the external information processing apparatus.

In the conventional technique disclosed in Japanese Patent Laid-Open No. 2009-302831, however, if the USB device is connected to the image forming apparatus, a power state to which the image forming apparatus shifts is uniformly determined in accordance with the class of the USB device. Therefore, depending on the class of the USB device, the image forming apparatus does not shift to the power saving state as long as the USB device is connected to the image forming apparatus. This may lead to a situation in which it is impossible to achieve power saving of the image forming apparatus connected to the USB device. To the contrary, depending on the class of the USB device, even though the USB device is connected, the image forming apparatus may shift to the power saving state at the time of connection of the USB device and the USB device may often become unusable. In this case, the USB device cannot be sufficiently used using USBNW communication. This impairs the convenience of the user who often uses USBNW communication.

SUMMARY OF THE INVENTION

The present invention has been made in consideration of the above problem, and provides a technique of appropriately shifting an image forming apparatus to the power saving state in consideration of the use status of an external device such as a connected USB device.

According to one aspect of the present invention, there is provided an image forming apparatus comprising: a connection unit to which a USB device is connected; a control unit configured to control communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; a shift unit configured to shift the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and an acceptance unit configured to accept a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit shifts the image forming apparatus from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit does not shift the image forming apparatus from the first power state to the second power state at the time of use of the USB device.

According to another aspect of the present invention, there is provided an image forming apparatus comprising: a connection unit to which a USB device is connected; a control unit configured to control communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; and a shift unit configured to shift the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped, wherein if the USB device is not in use, the shift unit shifts the image forming apparatus from the first power state to the second power state, and if the USB device is in use, the shift unit does not shift the image forming apparatus from the first power state to the second power state.

According to still another aspect of the present invention, there is provided a control method for an image forming apparatus including a connection unit to which a USB device is connected, comprising: controlling communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; shifting the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and accepting a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein in the shifting, if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is shifted from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is not shifted from the first power state to the second power state at the time of use of the USB device.

According to yet another aspect of the present invention, there is provided a non-transitory computer-readable storage medium storing a computer program for causing a computer to execute a control method for an image forming apparatus including a connection unit to which a USB device is connected, the control method comprising: controlling communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; shifting the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and accepting a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein in the shifting, if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is shifted from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is not shifted from the first power state to the second power state at the time of use of the USB device.

According to the present invention, it is possible to appropriately shift an image forming apparatus to the power saving state in consideration of the use status of an external device such as a connected USB device.

Further features of the present invention will become apparent from the following description of exemplary embodiments (with reference to the attached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A and 1B are block diagrams each showing an example of the arrangement of an image forming apparatus;

FIG. 2 illustrates a screen for setting the sleep mode of the image forming apparatus;

FIG. 3 illustrates a screen for setting a sleep shift at the time of use of a USB device;

FIG. 4 illustrates a modification of the screen for setting the sleep shift at the time of use of the USB device;

FIG. 5 illustrates a screen for setting a time until the apparatus is shifted to a sleep state;

FIG. 6 is a flowchart illustrating control of the power state of the image forming apparatus at the time of use of the USB device; and

FIG. 7 is a flowchart illustrating control of the power state of an image forming apparatus at the time of use of a USB device (second embodiment).

DESCRIPTION OF THE EMBODIMENTS

Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the following embodiments are not intended to limit the scope of the appended claims, and that not all the combinations of features described in the embodiments are necessarily essential to the solving means of the present invention.

First Embodiment

FIG. 1A is a block diagram showing an example of the arrangement of an image forming apparatus 100 according to the first embodiment. The image forming apparatus 100 includes a CPU 101, and a ROM 102, RAM 103, printer unit 104, operation panel 105, USB interface (I/F) 106, and network I/F 107 which are connected to the CPU 101 via a system bus 110. The USB I/F 106 serves as a communication interface for communication with a USB device connected to the image forming apparatus 100. The network I/F 107 serves as a communication interface for communication with an external communication apparatus via a network (LAN 160).

In this embodiment, the image forming apparatus 100, a USB device 150, and a terminal 170 all of which are shown in FIG. 1A are compatible with USBNW (USB over Network). The USBNW compatible USB device 150 is connectable to the USB I/F 106. The USB device 150 is, for example, a touch panel, card reader, USB memory, or table terminal. Furthermore, the network I/F 107 is communicable with the USBNW compatible external terminal 170 via the LAN 160. Using the USBNW technology makes it possible to control the USB device 150 from the terminal 170 using communication (USBNW communication) complying with USBNW. An application for controlling the USB device 150 is installed in the terminal 170, and is used to control the USB device 150 via the image forming apparatus 100. This allows the user to use the USB device 150 from the terminal 170 using USB communication. In this embodiment, the terminal 170 is an example of an external apparatus for controlling the operation of the USB device 150.

The CPU 101 serves as a system control unit, and controls the overall image forming apparatus 100. The ROM 102 stores a control program to be executed by the CPU 101. The ROM 102 according to this embodiment is a rewritable flash ROM, and stores data indicating setting values registered by the user of the image forming apparatus 100, and various data such as management data which can be changed, as needed. The RAM 103 is used as a work area for executing the program by the CPU 101, and also used as a temporary storage area for temporarily storing various data.

The printer unit 104 forms an image on a recording medium (recording paper) based on print data (image data) received from the external apparatus via the LAN 160. Furthermore, for example, if a tablet terminal is connected to the USB I/F 106 as the USB device 150, it is possible to form an image on a recording medium (recording paper) based on print data received from the tablet terminal. The operation panel 105 is formed by a keyboard, touch panel, LCD, LED, and the like, and accepts various operations from the user, display an operation screen, and sends a notification to the user.

As described above, when the USB device 150 is connected, the USB I/F 106 functions as an interface with the USB device 150, and controls communication with the USB device 150. The USB I/F 106 supplies power to the USB device 150. As described above, the network I/F 107 functions as an interface with the external apparatus communicable via the LAN 160, and transmits/receives data to/from the external apparatus via the LAN 160. The network I/F 107 receives, for example, print data and control information of the image forming apparatus 100 from the terminal 170. Note that the LAN 160 may be a wired LAN for wired communication or a wireless LAN for wireless communication.

FIG. 1B shows an example of the arrangement associated with power supply from a power supply 120 in the image forming apparatus 100. As shown in FIG. 1B, the power supply 120 supplies power to the printer unit 104, operation panel 105, and USB I/F 106 via switches 121, 122, and 123, respectively. The CPU 101 controls ON/OFF switching of each of the switches 121 to 123. If each of the switches 121 to 123 is in an ON state, power is supplied from the power supply 120 to the corresponding unit. If each of the switches 121 to 123 is in an OFF state, power supply from the power supply 120 to the corresponding unit is stopped.

The CPU 101 controls ON/OFF switching of each of the switches 121 to 123 in accordance with the state of the image forming apparatus 100. In this embodiment, the image forming apparatus 100 has a normal power state (usable state) and a power saving state (sleep state) in which the power consumption is lower than that in the normal power state. When shifting the image forming apparatus 100 from the normal power state to the sleep state, the CPU 101 stops power supply to the printer unit 104, operation panel 105, and USB I/F 106 by switching the switches 121 to 123 from the ON state to the OFF state. This achieves power saving of the image forming apparatus 100 in the sleep state.

The image forming apparatus 100 in the normal power state shifts to the sleep state when a condition for shifting to the sleep state is satisfied (for example, a predetermined sleep shift time elapses). In this embodiment, the user can set whether or not to shift the image forming apparatus 100 to the sleep state. If the user selects “level high (deep sleep)” as a sleep mode in a screen shown in FIG. 2, the image forming apparatus 100 is set to shift to the sleep state. If the user selects “OFF” as the sleep mode in the screen shown in FIG. 2, the image forming apparatus 100 is set not to shift to the sleep state. The setting of the sleep mode is held in the ROM 102.

In addition, in this embodiment, the user can set whether or not to shift the image forming apparatus 100 to the sleep state while the USB device 150 is used. If the user selects “permit” as a sleep shift at the time of use of USB in a screen shown in FIG. 3, the image forming apparatus 100 shifts to the sleep state even at the time of use of USB. If the user selects “do not permit” as a sleep shift at the time of use of USB in the screen shown in FIG. 3, the image forming apparatus 100 does not shift to the sleep state at the time of use of USB. Note that if the user selects “do not permit” as the sleep shift at the time of use of USB, when the USB device 150 is connected but is not used, the image forming apparatus 100 shifts to the sleep state. The setting of the sleep shift at the time of use of USB is held in the ROM 102. As described above, the CPU 101 performs acceptance processing of accepting, using the screen shown in FIG. 3, the user setting indicating whether or not to shift the image forming apparatus 100 to the sleep state at the time of use of the USB device 150.

Based on the setting of the sleep mode, the setting of the sleep shift at the time of use of USB, and the use status of the USB device 150, the CPU 101 determines whether or not to shift the image forming apparatus 100 to the sleep state.

More specifically, if the setting of the sleep mode is “OFF”, the image forming apparatus 100 does not shift to the sleep state. If the setting of the sleep mode is “level high (deep sleep)”, the CPU 101 determines, based on the setting of the sleep shift at the time of use of USB, whether or not to shift the image forming apparatus 100 to the sleep state. That is, if the setting of the sleep mode is “level high (deep sleep)” and the setting of the sleep shift at the time of use of USB is “permit”, when a predetermined condition is satisfied, the CPU 101 shifts the image forming apparatus 100 to the sleep state regardless of whether or not the USB device 150 is in use. On the other hand, if the setting of the sleep mode is “level high (deep sleep)” and the setting of the sleep shift at the time of use of USB is “do not permit”, when the USB device 150 is in use, the CPU 101 does not shift the image forming apparatus 100 to the sleep state. Furthermore, if the setting of the sleep mode is “level high (deep sleep)” and the setting of the sleep shift at the time of use of USB is “do not permit”, when the USB device 150 is not in use, the CPU 101 shifts the image forming apparatus 100 to the sleep state.

As described above, the image forming apparatus 100 according to this embodiment can shift itself to the sleep state at the time of use of the USB device 150 in accordance with the user setting (the setting of the sleep shift at the time of use of USB: permit). That is, it is possible to avoid a situation in which the image forming apparatus 100 does not shift to the sleep state at the time of use of the USB device 150 against the intention of the user who desires power saving.

The image forming apparatus 100 according to this embodiment can prevent itself from shifting to the sleep state at the time of use of the USB device 150 against the intention of the user who desires to prioritize the use of the USB device 150 in accordance with the user setting (the setting of sleep shift at the time of use of USB: do not permit).

A setting of shifting the image forming apparatus 100 to the sleep state will be described with reference to FIGS. 2, 3, 4, and 5. The setting screens shown in FIGS. 2 to 5 are displayed on the LCD of the operation panel 105 by a user operation using the operation panel 105.

A sleep mode setting screen 230 shown in FIG. 2 is a screen for setting a state to which the image forming apparatus 100 shifts when the predetermined condition is satisfied. The user can select one of “level high (deep sleep), “level medium (printer sleep)”, “level low (panel sleep)”, and “OFF” in the setting screen 230. If the user selects “level high (deep sleep)” in the setting screen 230, the image forming apparatus 100 shifts to the sleep state in which power supply to the printer unit 104, operation panel 105, and USB I/F 106 is stopped.

A setting screen 220, shown in FIG. 3, for setting the sleep shift at the time of use of the USB device 150 is a screen for selecting whether or not to permit a shift to the sleep state at the time of use of the USB device 150. If the user selects “do not permit” in the setting screen 220, the image forming apparatus 100 does not shift to the sleep state while the USB device 150 connected to the image forming apparatus 100 is used. If the user selects “permit” in the setting screen 220, the image forming apparatus 100 shifts to the sleep state even while the USB device 150 connected to the image forming apparatus 100 is used.

A setting screen 200 shown in FIG. 4 is a modification of the setting screen 220 shown in FIG. 3. “do not permit” in the setting screen 220 corresponds to “do not shift to sleep state at time of use” in the setting screen 200 shown in FIG. 4. Furthermore, “permit” in the setting screen 220 corresponds to “shift to sleep state even at time of use” in the setting screen 200 shown in FIG. 4.

FIG. 5 shows a screen for setting a time until the apparatus is shifted to the sleep state. The user can set a time until the image forming apparatus 100 is shifted to the sleep state in a setting screen 210 shown in FIG. 5. The user can select, for example, 1 min, 5 min, 30 min, or 60 min as a setting of the time in the setting screen 210. In the example shown in FIG. 5, 1 min is selected. The CPU 101 stores, in the ROM 102, information indicating the time selected in the setting screen 210. Note that such time (for example, 5 min) may be permanently preset without requiring setting using the setting screen 210.

FIG. 6 is a flowchart illustrating control of the power state of the image forming apparatus 100. Processing in each step shown in FIG. 6 is implemented in the image forming apparatus 100 when the CPU 101 reads out the control program stored in the ROM 102 and executes it. Note that, for example, if the USB device 150 is a card reader, USBNW communication is performed between the card reader and the terminal 170 when the user performs card authentication using the card reader.

In step S101, the CPU 101 determines whether or not the setting of the sleep mode is “level high (deep sleep)”. If the setting of the sleep mode is not “level high (deep sleep)”, the image forming apparatus 100 does not shift to the sleep state, and thus the processing of this flowchart ends. If it is determined that the setting of the sleep mode is “level high (deep sleep)” (YES in step S101), the CPU 101 advances the process to step S102.

In step S102, the CPU 101 determines whether or not the shift condition for shifting the image forming apparatus 100 to the sleep state has been satisfied. For example, if a time measured by a timer for determining a shift timing reaches a sleep shift time preset by the user, the CPU 101 determines that the shift condition is satisfied. Note that, for example, if the user operates the operation panel 105, the timer is reset to 0. If it is determined in step S102 that the shift condition has been satisfied, the CPU 101 advances the process to step S103.

In step S103, the CPU 101 determines whether or not the setting of the sleep shift at the time of use of the USB device is “permit”. If it is determined that the setting of the sleep shift at the time of use of the USB device is “permit”, the CPU 101 advances the process to step S104. In step S104, the CPU 101 shifts the image forming apparatus 100 to the sleep state. On the other hand, if it is determined that the setting of the sleep shift at the time of use of the USB device is “do not permit”, the CPU 101 advances the process to step S105.

In step S105, the CPU 101 determines whether or not the USB device 150 is in use. When starting USBNW communication, a connection request is transmitted from the terminal 170 serving as a host to the USB device 150. The USB device 150 transmits a response to the connection request transmitted from the terminal 170. This establishes a communication session between the terminal 170 and the USB device 150. When ending the USBNW communication, a disconnection request is transmitted from the terminal 170 to the USB device 150. The USB device 150 transmits a response to the disconnection request transmitted from the terminal 170. This disconnects the communication session between the terminal 170 and the USB device 150. The CPU 101 determines that the USB device 150 is in use during a period from when the connection request transmitted from the terminal 170 is received until the disconnection request is received. If it is determined that the USB device 150 is in use, the CPU 101 clears (resets) the timer in step S106; otherwise, the CPU 101 shifts the image forming apparatus 100 to the sleep state in step S107.

As described above, according to this embodiment, if the setting of the sleep shift at the time of use of the USB device is “permit” when the condition for shifting to the sleep state is satisfied, even if the USB device 150 is in use, the CPU 101 shifts the image forming apparatus 100 to the sleep state. On the other hand, if the setting of the sleep shift at the time of use of the USB device is “do not permit”, it is determined whether or not the connected USB device is in use. If the USB device 150 is in use, even if the USB device 150 is connected, the CPU 101 shifts the image forming apparatus 100 to the sleep state. This makes it possible to shift the image forming apparatus 100, to which the USB device 150 is currently connected, to the sleep state in accordance with the use status of the USB device 150 while maintaining the user convenience.

Second Embodiment

The second embodiment will describe an example in which an image forming apparatus 100 is shifted to the sleep state at the time of use of a USB device without requiring a user setting using the setting screen 220 shown in FIG. 3 or the setting screen 200 shown in FIG. 4. Note that a description of a part common to the first embodiment will be omitted and the difference from the first embodiment will be mainly described.

FIG. 7 is a flowchart illustrating control of the power state of the image forming apparatus 100 according to the second embodiment. Processing in each step shown in FIG. 7 is implemented in the image forming apparatus 100 when a CPU 101 reads out a control program stored in a ROM 102 and executes it.

In step S201, similarly to step S101, the CPU 101 determines whether or not a setting of a sleep mode is “level high (deep sleep)”. If the setting of the sleep mode is not “level high (deep sleep)”, the CPU 101 ends the processing of this flowchart; otherwise (YES in step S101), the CPU 101 advances the process to step S202.

In step S202, similarly to step S102, the CPU 101 determines whether or not a shift condition for shifting the image forming apparatus 100 to the sleep state has been satisfied. If it is determined that a shift timing has been reached, the CPU 101 advances the process to step S203.

In step S203, similarly to step S105, the CPU 101 determines whether or not a USB device 150 is in use. If it is determined in step S203 that the USB device 150 is in use, the CPU 101 advances the process to step S204; otherwise, the CPU 101 advances the process to step S205. The CPU 101 clears (resets) a timer in step S204, and shifts the image forming apparatus 100 to the sleep state in step S205.

As described above, according to this embodiment, when the condition for shifting to the sleep state is satisfied, the CPU 101 determines whether or not the connected USB device 150 is in use. If the USB device 150 is in use, the CPU 101 does not shift the image forming apparatus 100 to the sleep state; otherwise, the CPU 101 shifts the image forming apparatus 100 to the sleep state. Thus, it is possible to shift the image forming apparatus 100, to which the USB device 150 is currently connected, to the sleep state in accordance with the use status of the USB device 150. Since the user need not set whether or not to shift the image forming apparatus 100 to the sleep state even at the time of use of the USB device, the labor of user setting can be reduced.

Other Embodiments

Embodiment(s) of the present invention can also be realized by a computer of a system or apparatus that reads out and executes computer executable instructions (e.g., one or more programs) recorded on a storage medium (which may also be referred to more fully as a ‘non-transitory computer-readable storage medium’) to perform the functions of one or more of the above-described embodiment(s) and/or that includes one or more circuits (e.g., application specific integrated circuit (ASIC)) for performing the functions of one or more of the above-described embodiment(s), and by a method performed by the computer of the system or apparatus by, for example, reading out and executing the computer executable instructions from the storage medium to perform the functions of one or more of the above-described embodiment(s) and/or controlling the one or more circuits to perform the functions of one or more of the above-described embodiment(s). The computer may comprise one or more processors (e.g., central processing unit (CPU), micro processing unit (MPU)) and may include a network of separate computers or separate processors to read out and execute the computer executable instructions. The computer executable instructions may be provided to the computer, for example, from a network or the storage medium. The storage medium may include, for example, one or more of a hard disk, a random-access memory (RAM), a read only memory (ROM), a storage of distributed computing systems, an optical disk (such as a compact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flash memory device, a memory card, and the like.

While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

This application claims the benefit of Japanese Patent Application No. 2015-109122, filed May 28, 2015, and No. 2016-031463, filed Feb. 22, 2016, which are hereby incorporated by reference herein in their entirety. 

What is claimed is:
 1. An image forming apparatus comprising: a connection unit to which a USB device is connected; a control unit configured to control communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; a shift unit configured to shift the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and an acceptance unit configured to accept a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit shifts the image forming apparatus from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit does not shift the image forming apparatus from the first power state to the second power state at the time of use of the USB device.
 2. The apparatus according to claim 1, wherein based on whether or not a communication session has been established between the external apparatus and the USB device connected to the connection unit, the shift unit determines whether or not the USB device connected to the connection unit is in use.
 3. The apparatus according to claim 1, wherein the shift unit determines that the USB device is in use during a period from when a connection request to the USB device is received from the external apparatus until a disconnection request is received from the external apparatus.
 4. The apparatus according to claim 1, wherein when a shift condition for shifting the image forming apparatus to the second power state is satisfied, if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit determines whether or not the USB device is in use, and the shift unit does not shift the image forming apparatus to the second power state if it is determined that the USB device is in use, and shifts the image forming apparatus to the second power state if it is determined that the USB device is not in use.
 5. The apparatus according to claim 1, wherein when a shift condition for shifting the image forming apparatus to the second power state is satisfied, if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the shift unit shifts the image forming apparatus to the second power state without determining whether or not the USB device is in use.
 6. The apparatus according to claim 4, wherein the shift condition is that a time measured by a timer in the first power state reaches a sleep shift time preset by a user, and when the shift condition is satisfied, if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device and it is determined that the USB device is in use, the shift unit resets the timer.
 7. The apparatus according to claim 1, wherein the USB device and the external apparatus are compatible with USBNW (USB over Network), and the control unit controls USBNW communication between the external apparatus and the USB device connected to the connection unit.
 8. An image forming apparatus comprising: a connection unit to which a USB device is connected; a control unit configured to control communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; and a shift unit configured to shift the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped, wherein if the USB device is not in use, the shift unit shifts the image forming apparatus from the first power state to the second power state, and if the USB device is in use, the shift unit does not shift the image forming apparatus from the first power state to the second power state.
 9. The apparatus according to claim 8, wherein based on whether or not a communication session has been established between the external apparatus and the USB device connected to the connection unit, the shift unit determines whether or not the USB device connected to the connection unit is in use.
 10. The apparatus according to claim 8, wherein the shift unit determines that the USB device is in use during a period from when a connection request to the USB device is received from the external apparatus until a disconnection request is received from the external apparatus.
 11. The apparatus according to claim 8, wherein the USB device and the external apparatus are compatible with USBNW (USB over Network), and the control unit controls USBNW communication between the external apparatus and the USB device connected to the connection unit.
 12. A control method for an image forming apparatus including a connection unit to which a USB device is connected, comprising: controlling communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; shifting the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and accepting a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein in the shifting, if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is shifted from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is not shifted from the first power state to the second power state at the time of use of the USB device.
 13. A non-transitory computer-readable storage medium storing a computer program for causing a computer to execute a control method for an image forming apparatus including a connection unit to which a USB device is connected, the control method comprising: controlling communication between the USB device connected to the connection unit and an external apparatus for controlling an operation of the USB device; shifting the image forming apparatus from a first power state in which power is supplied to the connection unit to a second power state in which power supply to the connection unit is stopped; and accepting a user setting indicating whether or not to shift the image forming apparatus to the second power state at the time of use of the USB device, wherein in the shifting, if the user setting is set to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is shifted from the first power state to the second power state at the time of use of the USB device, and if the user setting is set not to shift the image forming apparatus to the second power state at the time of use of the USB device, the image forming apparatus is not shifted from the first power state to the second power state at the time of use of the USB device. 